<template>
  <div>
    <van-nav-bar
      title="更多服务"
      left-text=""
      right-text="···"
      left-arrow
      @click-left="funa()"
    />
    <div class="top">
      <div class="wode">热门推荐</div>
      <div class="navbox">
        <ul>
          <li v-for="(v, i) in moData" :key="i" @click="fun(v.url)">
            <p><img :src="v.imgUrl" /></p>
            <p class="toptex">{{ v.title }}</p>
          </li>
        </ul>
      </div>
      <div class="kong"></div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["moreData"],
  methods: {
    fun(url) {
      // 编程式方式进行----路由跳转
      this.$router.push(url);
    },
    funa() {
      // 编程式方式进行----路由跳转
      this.$router.push("/life");
    },
  },
  //使用计算属性-----截取部分数据
  computed: {
    moData: function () {
      return this.moreData.slice(0, 8);
    },
  },
};
</script>

<style lang="less" scoped>
.top {
  width: 100%;
  height: 0.26rem;
  border-bottom: 0.0125rem rgb(228, 228, 228) solid;
}
.wode {
  width: 90%;
  height: 0.16rem;
  line-height: 0.16rem;
  margin: 0.125rem auto;
  font-size: 0.15rem;
  padding-left: 0.125rem;
  font-weight: bold;
  border-left: 0.0467rem solid #0053a7;
}
.kong {
  width: 100%;
  height: 0.07rem;
  background-color: #efefef;
}
.navbox {
  width: 95%;
  height: auto;
  background-color: #fff;
  margin: auto;
}
ul {
  display: flex;
  flex-wrap: wrap;
  height: 100%;

  li {
    width: 25%;
    text-align: center;
    font-size: 0.14rem;
    align-items: center;
    margin-top: 0.2rem;
    margin-bottom: 0.1rem;

    p {
      span {
        font-size: 0.3rem;
      }
    }
  }
}
.toptex {
  margin-top: 0.0067rem;
}
img {
  width: 0.3rem;
  height: 0.3rem;
}
</style>